In [1]:
# rasterio
In [6]:
print("Let's Learn DS and ML;")
Let's Learn DS and ML;
In [1]:
pip install rasterio
Collecting rasterio
Downloading rasterio-1.4.3-cp311-cp311-win_amd64.whl.metadata (9.4 kB)
Collecting affine (from rasterio)
Downloading affine-2.4.0-py3-none-any.whl.metadata (4.0 kB)
Requirement already satisfied: attrs in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from rasterio) (23.2.0)
Requirement already satisfied: certifi in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from rasterio) (2024.7.4)
Requirement already satisfied: click>=4.0 in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from rasterio) (8.1.8)
Collecting cligj>=0.5 (from rasterio)
Downloading cligj-0.7.2-py3-none-any.whl.metadata (5.0 kB)
Requirement already satisfied: numpy>=1.24 in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from rasterio) (1.26.4)
Collecting click-plugins (from rasterio)
Downloading click_plugins-1.1.1-py2.py3-none-any.whl.metadata (6.4 kB)
Requirement already satisfied: pyparsing in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from rasterio) (3.1.2)
Requirement already satisfied: colorama in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from click>=4.0->rasterio) (0.4.6)
Downloading rasterio-1.4.3-cp311-cp311-win_amd64.whl (25.5 MB)
---------------------------------------- 0.0/25.5 MB ? eta -:--:--
---------------------------------------- 0.0/25.5 MB 1.3 MB/s eta 0:00:20
---------------------------------------- 0.0/25.5 MB 1.3 MB/s eta 0:00:20
---------------------------------------- 0.1/25.5 MB 751.6 kB/s eta 0:00:34
---------------------------------------- 0.1/25.5 MB 774.0 kB/s eta 0:00:33
---------------------------------------- 0.2/25.5 MB 1.1 MB/s eta 0:00:23
---------------------------------------- 0.2/25.5 MB 1.1 MB/s eta 0:00:23
---------------------------------------- 0.3/25.5 MB 999.9 kB/s eta 0:00:26
--------------------------------------- 0.3/25.5 MB 952.6 kB/s eta 0:00:27
--------------------------------------- 0.4/25.5 MB 882.8 kB/s eta 0:00:29
--------------------------------------- 0.4/25.5 MB 890.4 kB/s eta 0:00:29
--------------------------------------- 0.5/25.5 MB 909.8 kB/s eta 0:00:28
--------------------------------------- 0.5/25.5 MB 925.6 kB/s eta 0:00:27
--------------------------------------- 0.5/25.5 MB 917.3 kB/s eta 0:00:28
--------------------------------------- 0.5/25.5 MB 917.3 kB/s eta 0:00:28
--------------------------------------- 0.5/25.5 MB 814.7 kB/s eta 0:00:31
--------------------------------------- 0.6/25.5 MB 772.0 kB/s eta 0:00:33
--------------------------------------- 0.6/25.5 MB 753.4 kB/s eta 0:00:34
- -------------------------------------- 0.7/25.5 MB 844.9 kB/s eta 0:00:30
- -------------------------------------- 0.7/25.5 MB 834.5 kB/s eta 0:00:30
- -------------------------------------- 0.8/25.5 MB 904.2 kB/s eta 0:00:28
- -------------------------------------- 0.9/25.5 MB 913.3 kB/s eta 0:00:27
- -------------------------------------- 0.9/25.5 MB 911.4 kB/s eta 0:00:27
- -------------------------------------- 1.0/25.5 MB 953.5 kB/s eta 0:00:26
- -------------------------------------- 1.0/25.5 MB 953.5 kB/s eta 0:00:26
- -------------------------------------- 1.0/25.5 MB 888.5 kB/s eta 0:00:28
- -------------------------------------- 1.1/25.5 MB 897.2 kB/s eta 0:00:28
- -------------------------------------- 1.1/25.5 MB 912.8 kB/s eta 0:00:27
- -------------------------------------- 1.2/25.5 MB 946.4 kB/s eta 0:00:26
- -------------------------------------- 1.3/25.5 MB 952.2 kB/s eta 0:00:26
-- ------------------------------------- 1.3/25.5 MB 930.9 kB/s eta 0:00:26
-- ------------------------------------- 1.3/25.5 MB 921.7 kB/s eta 0:00:27
-- ------------------------------------- 1.4/25.5 MB 951.4 kB/s eta 0:00:26
-- ------------------------------------- 1.4/25.5 MB 945.6 kB/s eta 0:00:26
-- ------------------------------------- 1.5/25.5 MB 953.2 kB/s eta 0:00:26
-- ------------------------------------- 1.6/25.5 MB 970.0 kB/s eta 0:00:25
-- ------------------------------------- 1.6/25.5 MB 983.2 kB/s eta 0:00:25
-- ------------------------------------- 1.7/25.5 MB 974.1 kB/s eta 0:00:25
-- ------------------------------------- 1.7/25.5 MB 983.0 kB/s eta 0:00:25
-- ------------------------------------- 1.8/25.5 MB 985.8 kB/s eta 0:00:25
-- ------------------------------------- 1.8/25.5 MB 989.0 kB/s eta 0:00:24
-- ------------------------------------- 1.9/25.5 MB 983.0 kB/s eta 0:00:25
--- ------------------------------------ 1.9/25.5 MB 983.3 kB/s eta 0:00:24
--- ------------------------------------ 1.9/25.5 MB 982.9 kB/s eta 0:00:24
--- ------------------------------------ 2.0/25.5 MB 1.0 MB/s eta 0:00:24
--- ------------------------------------ 2.1/25.5 MB 1.0 MB/s eta 0:00:24
--- ------------------------------------ 2.1/25.5 MB 1.0 MB/s eta 0:00:24
--- ------------------------------------ 2.2/25.5 MB 1.0 MB/s eta 0:00:24
--- ------------------------------------ 2.3/25.5 MB 1.0 MB/s eta 0:00:23
--- ------------------------------------ 2.3/25.5 MB 1.0 MB/s eta 0:00:23
--- ------------------------------------ 2.4/25.5 MB 1.0 MB/s eta 0:00:23
--- ------------------------------------ 2.4/25.5 MB 1.0 MB/s eta 0:00:23
--- ------------------------------------ 2.4/25.5 MB 1.0 MB/s eta 0:00:23
--- ------------------------------------ 2.5/25.5 MB 1.0 MB/s eta 0:00:23
--- ------------------------------------ 2.5/25.5 MB 1.0 MB/s eta 0:00:23
---- ----------------------------------- 2.6/25.5 MB 1.0 MB/s eta 0:00:23
---- ----------------------------------- 2.6/25.5 MB 1.0 MB/s eta 0:00:23
---- ----------------------------------- 2.7/25.5 MB 1.0 MB/s eta 0:00:23
---- ----------------------------------- 2.8/25.5 MB 1.0 MB/s eta 0:00:23
---- ----------------------------------- 2.8/25.5 MB 1.0 MB/s eta 0:00:22
---- ----------------------------------- 2.8/25.5 MB 1.0 MB/s eta 0:00:23
---- ----------------------------------- 2.9/25.5 MB 1.0 MB/s eta 0:00:22
---- ----------------------------------- 3.0/25.5 MB 1.0 MB/s eta 0:00:22
---- ----------------------------------- 3.0/25.5 MB 1.0 MB/s eta 0:00:22
---- ----------------------------------- 3.1/25.5 MB 1.0 MB/s eta 0:00:22
---- ----------------------------------- 3.1/25.5 MB 1.0 MB/s eta 0:00:22
----- ---------------------------------- 3.2/25.5 MB 1.0 MB/s eta 0:00:22
----- ---------------------------------- 3.3/25.5 MB 1.1 MB/s eta 0:00:22
----- ---------------------------------- 3.3/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.4/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.4/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.5/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.5/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.6/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.6/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.7/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.7/25.5 MB 1.1 MB/s eta 0:00:21
----- ---------------------------------- 3.8/25.5 MB 1.1 MB/s eta 0:00:21
------ --------------------------------- 3.8/25.5 MB 1.1 MB/s eta 0:00:21
------ --------------------------------- 3.8/25.5 MB 1.1 MB/s eta 0:00:21
------ --------------------------------- 3.9/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.0/25.5 MB 1.1 MB/s eta 0:00:21
------ --------------------------------- 4.0/25.5 MB 1.1 MB/s eta 0:00:21
------ --------------------------------- 4.0/25.5 MB 1.1 MB/s eta 0:00:21
------ --------------------------------- 4.1/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.1/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.1/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.2/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.2/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.3/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.3/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.4/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.4/25.5 MB 1.0 MB/s eta 0:00:21
------ --------------------------------- 4.4/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 4.5/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 4.6/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 4.6/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 4.6/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 4.7/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 4.8/25.5 MB 1.0 MB/s eta 0:00:20
------- -------------------------------- 4.8/25.5 MB 1.0 MB/s eta 0:00:20
------- -------------------------------- 4.9/25.5 MB 1.0 MB/s eta 0:00:20
------- -------------------------------- 4.9/25.5 MB 1.0 MB/s eta 0:00:20
------- -------------------------------- 4.9/25.5 MB 1.0 MB/s eta 0:00:20
------- -------------------------------- 4.9/25.5 MB 1.0 MB/s eta 0:00:20
------- -------------------------------- 5.0/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 5.0/25.5 MB 1.0 MB/s eta 0:00:21
------- -------------------------------- 5.1/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.1/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.2/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.2/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.3/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.3/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.4/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.4/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.5/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.6/25.5 MB 1.0 MB/s eta 0:00:20
-------- ------------------------------- 5.7/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 5.7/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 5.8/25.5 MB 1.1 MB/s eta 0:00:19
--------- ------------------------------ 5.8/25.5 MB 1.1 MB/s eta 0:00:19
--------- ------------------------------ 5.8/25.5 MB 1.0 MB/s eta 0:00:20
--------- ------------------------------ 5.8/25.5 MB 1.0 MB/s eta 0:00:20
--------- ------------------------------ 5.9/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 6.0/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 6.0/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 6.1/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 6.2/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 6.2/25.5 MB 1.0 MB/s eta 0:00:19
--------- ------------------------------ 6.3/25.5 MB 1.0 MB/s eta 0:00:19
---------- ----------------------------- 6.4/25.5 MB 1.1 MB/s eta 0:00:19
---------- ----------------------------- 6.4/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 6.5/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 6.6/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 6.6/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 6.7/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 6.8/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 6.8/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 6.9/25.5 MB 1.1 MB/s eta 0:00:18
---------- ----------------------------- 7.0/25.5 MB 1.1 MB/s eta 0:00:18
----------- ---------------------------- 7.1/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.2/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.2/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.2/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.2/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.3/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.3/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.3/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.4/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.5/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.6/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.6/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.6/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.6/25.5 MB 1.1 MB/s eta 0:00:17
----------- ---------------------------- 7.6/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 7.6/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 7.7/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 7.8/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 7.8/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 7.9/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 8.0/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 8.0/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 8.0/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 8.1/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 8.1/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 8.2/25.5 MB 1.1 MB/s eta 0:00:17
------------ --------------------------- 8.3/25.5 MB 1.1 MB/s eta 0:00:17
------------- -------------------------- 8.3/25.5 MB 1.1 MB/s eta 0:00:17
------------- -------------------------- 8.3/25.5 MB 1.1 MB/s eta 0:00:17
------------- -------------------------- 8.3/25.5 MB 1.1 MB/s eta 0:00:17
------------- -------------------------- 8.4/25.5 MB 1.1 MB/s eta 0:00:16
------------- -------------------------- 8.5/25.5 MB 1.1 MB/s eta 0:00:16
------------- -------------------------- 8.6/25.5 MB 1.1 MB/s eta 0:00:16
------------- -------------------------- 8.6/25.5 MB 1.1 MB/s eta 0:00:16
------------- -------------------------- 8.7/25.5 MB 1.1 MB/s eta 0:00:16
------------- -------------------------- 8.8/25.5 MB 1.1 MB/s eta 0:00:16
------------- -------------------------- 8.8/25.5 MB 1.1 MB/s eta 0:00:16
------------- -------------------------- 8.9/25.5 MB 1.1 MB/s eta 0:00:16
-------------- ------------------------- 9.0/25.5 MB 1.1 MB/s eta 0:00:16
-------------- ------------------------- 9.0/25.5 MB 1.1 MB/s eta 0:00:16
-------------- ------------------------- 9.1/25.5 MB 1.1 MB/s eta 0:00:16
-------------- ------------------------- 9.1/25.5 MB 1.1 MB/s eta 0:00:15
-------------- ------------------------- 9.2/25.5 MB 1.1 MB/s eta 0:00:15
-------------- ------------------------- 9.3/25.5 MB 1.1 MB/s eta 0:00:15
-------------- ------------------------- 9.3/25.5 MB 1.1 MB/s eta 0:00:15
-------------- ------------------------- 9.4/25.5 MB 1.1 MB/s eta 0:00:15
-------------- ------------------------- 9.5/25.5 MB 1.1 MB/s eta 0:00:15
-------------- ------------------------- 9.5/25.5 MB 1.1 MB/s eta 0:00:15
--------------- ------------------------ 9.6/25.5 MB 1.1 MB/s eta 0:00:15
--------------- ------------------------ 9.7/25.5 MB 1.1 MB/s eta 0:00:15
--------------- ------------------------ 9.8/25.5 MB 1.1 MB/s eta 0:00:15
--------------- ------------------------ 9.9/25.5 MB 1.1 MB/s eta 0:00:15
--------------- ------------------------ 9.9/25.5 MB 1.1 MB/s eta 0:00:14
--------------- ------------------------ 10.0/25.5 MB 1.1 MB/s eta 0:00:14
--------------- ------------------------ 10.0/25.5 MB 1.1 MB/s eta 0:00:14
--------------- ------------------------ 10.1/25.5 MB 1.1 MB/s eta 0:00:14
--------------- ------------------------ 10.1/25.5 MB 1.1 MB/s eta 0:00:14
--------------- ------------------------ 10.2/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.3/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.3/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.3/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.4/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.5/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.5/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.6/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.6/25.5 MB 1.1 MB/s eta 0:00:14
---------------- ----------------------- 10.7/25.5 MB 1.1 MB/s eta 0:00:13
---------------- ----------------------- 10.8/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 10.9/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 10.9/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 11.0/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 11.1/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 11.2/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 11.2/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 11.3/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 11.4/25.5 MB 1.2 MB/s eta 0:00:13
----------------- ---------------------- 11.4/25.5 MB 1.2 MB/s eta 0:00:13
------------------ --------------------- 11.5/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 11.6/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 11.6/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 11.6/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 11.7/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 11.8/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 11.8/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 11.9/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 12.0/25.5 MB 1.2 MB/s eta 0:00:12
------------------ --------------------- 12.0/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.1/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.2/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.2/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.2/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.3/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.3/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.4/25.5 MB 1.2 MB/s eta 0:00:12
------------------- -------------------- 12.5/25.5 MB 1.2 MB/s eta 0:00:11
------------------- -------------------- 12.6/25.5 MB 1.2 MB/s eta 0:00:11
------------------- -------------------- 12.7/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.7/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.8/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.8/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.9/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.9/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.9/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.9/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.9/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 12.9/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 13.0/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 13.0/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 13.1/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 13.2/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 13.3/25.5 MB 1.2 MB/s eta 0:00:11
-------------------- ------------------- 13.3/25.5 MB 1.2 MB/s eta 0:00:11
--------------------- ------------------ 13.4/25.5 MB 1.2 MB/s eta 0:00:11
--------------------- ------------------ 13.5/25.5 MB 1.2 MB/s eta 0:00:11
--------------------- ------------------ 13.5/25.5 MB 1.2 MB/s eta 0:00:11
--------------------- ------------------ 13.6/25.5 MB 1.2 MB/s eta 0:00:10
--------------------- ------------------ 13.7/25.5 MB 1.2 MB/s eta 0:00:10
--------------------- ------------------ 13.7/25.5 MB 1.2 MB/s eta 0:00:10
--------------------- ------------------ 13.8/25.5 MB 1.2 MB/s eta 0:00:10
--------------------- ------------------ 13.9/25.5 MB 1.2 MB/s eta 0:00:10
--------------------- ------------------ 14.0/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.0/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.1/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.2/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.3/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.3/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.4/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.4/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.4/25.5 MB 1.2 MB/s eta 0:00:10
---------------------- ----------------- 14.5/25.5 MB 1.2 MB/s eta 0:00:09
---------------------- ----------------- 14.5/25.5 MB 1.2 MB/s eta 0:00:09
---------------------- ----------------- 14.5/25.5 MB 1.2 MB/s eta 0:00:09
---------------------- ----------------- 14.6/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 14.6/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 14.7/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 14.7/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 14.8/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 14.8/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 14.9/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 15.0/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 15.0/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 15.1/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 15.1/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 15.2/25.5 MB 1.2 MB/s eta 0:00:09
----------------------- ---------------- 15.2/25.5 MB 1.2 MB/s eta 0:00:09
------------------------ --------------- 15.3/25.5 MB 1.2 MB/s eta 0:00:09
------------------------ --------------- 15.4/25.5 MB 1.2 MB/s eta 0:00:09
------------------------ --------------- 15.5/25.5 MB 1.2 MB/s eta 0:00:09
------------------------ --------------- 15.6/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.6/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.6/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.7/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.7/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.7/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.8/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.8/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.8/25.5 MB 1.2 MB/s eta 0:00:08
------------------------ --------------- 15.9/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 15.9/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.0/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.0/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.0/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.1/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.1/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.1/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.1/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.1/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.2/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.3/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.3/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.4/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
------------------------- -------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.5/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 16.6/25.5 MB 1.1 MB/s eta 0:00:08
-------------------------- ------------- 17.0/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 17.1/25.5 MB 1.2 MB/s eta 0:00:08
-------------------------- ------------- 17.1/25.5 MB 1.2 MB/s eta 0:00:08
--------------------------- ------------ 17.2/25.5 MB 1.2 MB/s eta 0:00:08
--------------------------- ------------ 17.2/25.5 MB 1.2 MB/s eta 0:00:08
--------------------------- ------------ 17.3/25.5 MB 1.2 MB/s eta 0:00:07
--------------------------- ------------ 17.4/25.5 MB 1.2 MB/s eta 0:00:07
--------------------------- ------------ 17.4/25.5 MB 1.2 MB/s eta 0:00:07
--------------------------- ------------ 17.5/25.5 MB 1.2 MB/s eta 0:00:07
--------------------------- ------------ 17.6/25.5 MB 1.2 MB/s eta 0:00:07
--------------------------- ------------ 17.6/25.5 MB 1.2 MB/s eta 0:00:07
--------------------------- ------------ 17.7/25.5 MB 1.2 MB/s eta 0:00:07
--------------------------- ------------ 17.7/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 17.8/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 17.9/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 17.9/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 18.0/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 18.0/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 18.1/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 18.2/25.5 MB 1.2 MB/s eta 0:00:07
---------------------------- ----------- 18.3/25.5 MB 1.2 MB/s eta 0:00:06
---------------------------- ----------- 18.3/25.5 MB 1.2 MB/s eta 0:00:06
---------------------------- ----------- 18.4/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 18.5/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 18.6/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 18.6/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 18.7/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 18.8/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 18.9/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 18.9/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 19.0/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 19.0/25.5 MB 1.2 MB/s eta 0:00:06
----------------------------- ---------- 19.1/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.1/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.2/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.2/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.3/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.3/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.3/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.4/25.5 MB 1.2 MB/s eta 0:00:06
------------------------------ --------- 19.4/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.5/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.5/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.5/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.5/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.6/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.6/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.7/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------ --------- 19.7/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 19.7/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 19.8/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 19.9/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 19.9/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.0/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.0/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.1/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.1/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.1/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.2/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.2/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.3/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.3/25.5 MB 1.2 MB/s eta 0:00:05
------------------------------- -------- 20.4/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.4/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.5/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.6/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.6/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.6/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.7/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.7/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.8/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.8/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.8/25.5 MB 1.2 MB/s eta 0:00:05
-------------------------------- ------- 20.9/25.5 MB 1.1 MB/s eta 0:00:04
-------------------------------- ------- 21.0/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.1/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.1/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.2/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.2/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.3/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.3/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.4/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.4/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.5/25.5 MB 1.1 MB/s eta 0:00:04
--------------------------------- ------ 21.6/25.5 MB 1.1 MB/s eta 0:00:04
---------------------------------- ----- 21.7/25.5 MB 1.1 MB/s eta 0:00:04
---------------------------------- ----- 21.8/25.5 MB 1.1 MB/s eta 0:00:04
---------------------------------- ----- 21.9/25.5 MB 1.1 MB/s eta 0:00:04
---------------------------------- ----- 21.9/25.5 MB 1.1 MB/s eta 0:00:04
---------------------------------- ----- 22.0/25.5 MB 1.1 MB/s eta 0:00:04
---------------------------------- ----- 22.1/25.5 MB 1.2 MB/s eta 0:00:03
---------------------------------- ----- 22.2/25.5 MB 1.2 MB/s eta 0:00:03
---------------------------------- ----- 22.2/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.3/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.4/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.5/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.5/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.6/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.7/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.7/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.7/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.8/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.9/25.5 MB 1.2 MB/s eta 0:00:03
----------------------------------- ---- 22.9/25.5 MB 1.2 MB/s eta 0:00:03
------------------------------------ --- 22.9/25.5 MB 1.1 MB/s eta 0:00:03
------------------------------------ --- 23.0/25.5 MB 1.2 MB/s eta 0:00:03
------------------------------------ --- 23.1/25.5 MB 1.2 MB/s eta 0:00:03
------------------------------------ --- 23.2/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------ --- 23.3/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------ --- 23.3/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------ --- 23.4/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------ --- 23.4/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------ --- 23.5/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 23.6/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 23.7/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 23.7/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 23.8/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 23.8/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 23.8/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 23.9/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 24.0/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 24.1/25.5 MB 1.2 MB/s eta 0:00:02
------------------------------------- -- 24.2/25.5 MB 1.2 MB/s eta 0:00:02
-------------------------------------- - 24.2/25.5 MB 1.2 MB/s eta 0:00:02
-------------------------------------- - 24.3/25.5 MB 1.2 MB/s eta 0:00:02
-------------------------------------- - 24.3/25.5 MB 1.2 MB/s eta 0:00:01
-------------------------------------- - 24.3/25.5 MB 1.2 MB/s eta 0:00:01
-------------------------------------- - 24.3/25.5 MB 1.2 MB/s eta 0:00:01
-------------------------------------- - 24.4/25.5 MB 1.2 MB/s eta 0:00:01
-------------------------------------- - 24.4/25.5 MB 1.2 MB/s eta 0:00:01
-------------------------------------- - 24.4/25.5 MB 1.2 MB/s eta 0:00:01
-------------------------------------- - 24.4/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.5/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.6/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.6/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.6/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.6/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.7/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.7/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.8/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.8/25.5 MB 1.1 MB/s eta 0:00:01
-------------------------------------- - 24.8/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 24.9/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 24.9/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 24.9/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.0/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.1/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.1/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.1/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.1/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.2/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.3/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.4/25.5 MB 1.1 MB/s eta 0:00:01
--------------------------------------- 25.4/25.5 MB 1.1 MB/s eta 0:00:01
---------------------------------------- 25.5/25.5 MB 1.1 MB/s eta 0:00:00
Downloading cligj-0.7.2-py3-none-any.whl (7.1 kB)
Downloading affine-2.4.0-py3-none-any.whl (15 kB)
Downloading click_plugins-1.1.1-py2.py3-none-any.whl (7.5 kB)
Installing collected packages: affine, cligj, click-plugins, rasterio
Successfully installed affine-2.4.0 click-plugins-1.1.1 cligj-0.7.2 rasterio-1.4.3
Note: you may need to restart the kernel to use updated packages.
WARNING: The script rio.exe is installed in 'C:\Users\DELL\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. [notice] A new release of pip is available: 24.0 -> 25.0.1 [notice] To update, run: C:\Users\DELL\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip
In [24]:
import numpy as np
import rasterio as rio
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
band_path = r"C:\Users\DELL\Desktop\updated\2025-01-10-00_00_2025-01-10-23_59_Sentinel-2_L2A_B04_(Raw).tiff"
def read_band(band_path):
with rio.open(band_path) as src:
return src.read(1).astype(np.float32) / 10000
# Call the function
band_data = read_band(band_path)
# Check if data is loaded
print("Band shape:", band_data.shape)
print("Band min:", np.min(band_data))
print("Band max:", np.max(band_data))
# Plot the band
plt.figure(figsize=(10, 6))
sns.heatmap(band_data, cmap='viridis', cbar=True)
plt.title("Sentinel-2 Band Visualization")
plt.axis('off')
plt.show()
Band shape: (299, 1461) Band min: 0.0 Band max: 2.221e-05
In [29]:
import numpy as np
import rasterio as rio
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
import os
warnings.filterwarnings('ignore')
band_path = r"C:\Users\DELL\Desktop\updated\2025-01-10-00_00_2025-01-10-23_59_Sentinel-2_L2A_B04_(Raw).tiff"
def read_band(band_path):
try:
with rio.open(band_path) as src:
return src.read(1).astype(np.float32) / 10000
except rio.errors.RasterioIOError as e:
print(f"Error reading raster file: {e}")
return None
except Exception as e:
print(f"Unexpected error: {e}")
return None
def extract_band_name(band_path):
try:
filename = os.path.basename(band_path)
parts = filename.split("_")
band_code = parts[6] # Get 'B04'
band_mapping = {
'B02': 'Blue',
'B03': 'Green',
'B04': 'Red',
'B08': 'NIR',
'B11': 'SWIR1',
'B12': 'SWIR2'
}
return f"{band_code} - {band_mapping.get(band_code, 'Unknown')}"
except IndexError:
return "Unknown Band (Filename format issue)"
except Exception as e:
print(f"Error extracting band name: {e}")
return "Unknown Band"
# Read the band data
band_data = read_band(band_path)
band_label = extract_band_name(band_path)
# Continue only if data is successfully loaded
if band_data is not None:
print("Band:", band_label)
print("Shape:", band_data.shape)
print("Min:", np.min(band_data))
print("Max:", np.max(band_data))
# Plot
plt.figure(figsize=(10, 6))
sns.heatmap(band_data, cmap='viridis', cbar=True)
plt.title(f"Sentinel-2 Band Visualization: {band_label}")
plt.axis('off')
plt.show()
else:
print("Unable to display the raster band due to a loading error.")
Band: B04 - Red Shape: (299, 1461) Min: 0.0 Max: 2.221e-05
In [30]:
import os
import numpy as np
import rasterio as rio
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
folder_path = r"C:\Users\DELL\Desktop\updated"
band_mapping = {
'B02': 'Blue',
'B03': 'Green',
'B04': 'Red',
'B08': 'NIR',
'B11': 'SWIR1',
'B12': 'SWIR2'
}
def read_band(band_path):
try:
with rio.open(band_path) as src:
return src.read(1).astype(np.float32) / 10000
except Exception as e:
print(f"[ERROR] Failed to read {band_path} → {e}")
return None
def extract_band_name(filename):
try:
parts = filename.split("_")
band_code = parts[6] # e.g., 'B04'
return f"{band_code} - {band_mapping.get(band_code, 'Unknown')}"
except:
return "Unknown Band"
for file in os.listdir(folder_path):
if file.endswith(".tiff") or file.endswith(".tif"):
band_path = os.path.join(folder_path, file)
band_data = read_band(band_path)
band_label = extract_band_name(file)
if band_data is not None:
print(f"📄 {file}")
print("→ Band:", band_label)
print("→ Shape:", band_data.shape)
print("→ Min:", np.min(band_data), "→ Max:", np.max(band_data))
# Plot the band
plt.figure(figsize=(10, 6))
sns.heatmap(band_data, cmap='viridis', cbar=True)
plt.title(f"Sentinel-2 Band Visualization: {band_label}")
plt.axis('off')
plt.show()
📄 2025-01-10-00_00_2025-01-10-23_59_Sentinel-2_L2A_B04_(Raw).tiff → Band: B04 - Red → Shape: (299, 1461) → Min: 0.0 → Max: 2.221e-05
📄 2025-01-10-00_00_2025-01-10-23_59_Sentinel-2_L2A_B08_(Raw).tiff → Band: B08 - NIR → Shape: (299, 1461) → Min: 0.0 → Max: 7.1509996e-05
📄 2025-01-10-00_00_2025-01-10-23_59_Sentinel-2_L2A_B11_(Raw).tiff → Band: B11 - SWIR1 → Shape: (299, 1461) → Min: 0.0 → Max: 3.673e-05
📄 2025-02-09-00_00_2025-02-09-23_59_Sentinel-2_L2A_B04_(Raw).tiff → Band: B04 - Red → Shape: (299, 1461) → Min: 0.0 → Max: 2.201e-05
📄 2025-02-09-00_00_2025-02-09-23_59_Sentinel-2_L2A_B08_(Raw).tiff → Band: B08 - NIR → Shape: (299, 1461) → Min: 0.0 → Max: 5.546e-05
📄 2025-02-09-00_00_2025-02-09-23_59_Sentinel-2_L2A_B11_(Raw).tiff → Band: B11 - SWIR1 → Shape: (299, 1461) → Min: 0.0 → Max: 4.015e-05
In [45]:
import os
import numpy as np
import rasterio as rio
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
# Folder containing .tif files
folder_path = r"C:\Users\DELL\Downloads\B"
# Function to read a band
def read_band(folder, band_code):
for file in os.listdir(folder):
if band_code in file and file.endswith((".tif", ".tiff")):
try:
with rio.open(os.path.join(folder, file)) as src:
return src.read(1).astype(np.float32) / 10000
except Exception as e:
print(f"❌ Error reading {band_code}: {e}")
return None
print(f"⚠️ Band {band_code} not found.")
return None
# Load required bands
B02 = read_band(folder_path, "B02") # Blue
B04 = read_band(folder_path, "B04") # Red
B08 = read_band(folder_path, "B08") # NIR
B11 = read_band(folder_path, "B11") # SWIR
# Check if all required bands are loaded
# Check if all required bands are loaded
if all(band is not None for band in [B04, B08, B11]):
eps = 1e-6 # to prevent division by zero
# Compute indices
NDVI = (B08 - B04) / (B08 + B04 + eps)
NDWI = (B08 - B11) / (B08 + B11 + eps)
BSI = ((B11 + B04) - (B08 + B02)) / ((B11 + B04) + (B08 + B02) + eps)
IOI = (B11 - B04) / (B11 + B04 + eps)
# Plotting function
def plot_index(data, title, cmap, vmin=-1, vmax=1):
plt.figure(figsize=(10, 6))
sns.heatmap(data, cmap=cmap, cbar=True, vmin=vmin, vmax=vmax)
plt.title(title)
plt.axis('off')
plt.tight_layout()
plt.show()
# Plot all indices
plot_index(NDVI, "NDVI - Vegetation Index", cmap='RdYlGn')
plot_index(NDWI, "NDWI - Moisture Index (Gao)", cmap='YlGnBu')
plot_index(BSI, "BSI - Bare Soil Index", cmap='YlOrBr')
plot_index(IOI, "IOI - Iron Oxide Index", cmap='Reds')
else:
print("❌ One or more required bands are missing.")
In [10]:
import numpy as np
import rasterio
import matplotlib.pyplot as plt
import seaborn as sns
import warnings
import os
from datetime import datetime
import scipy.stats as stats
# Suppress warnings
warnings.filterwarnings('ignore')
# Function to read Sentinel-2 band and return shape
def read_band(band_path):
with rasterio.open(band_path) as src:
return src.read(1).astype(np.float32) / 10000 # Normalize
In [11]:
def compute_indices(data):
# Print keys and shapes for debugging (optional, remove if not needed)
print("Keys in data:", data.keys())
for key, arr in data.items():
print(f"Shape of {key}: {arr.shape}")
# Check if all arrays have the same shape
shapes = [arr.shape for arr in data.values()]
if not all(shape == shapes[0] for shape in shapes):
raise ValueError(f"Shape mismatch in bands: {shapes}")
# Compute indices using correct keys
ndvi = safe_divide(data["B08"] - data["B04"], data["B08"] + data["B04"])
ndwi = safe_divide(data["B08"] - data["B11"], data["B08"] + data["B11"])
bsi = safe_divide((data["B11"] + data["B04"]) - (data["B08"] + data["B02"]),
(data["B11"] + data["B04"]) + (data["B08"] + data["B02"]))
ioi = safe_divide(data["B04"] + data["B08"], data["B04"] - data["B08"])
return ndvi, ndwi, bsi, ioi
# Safe division
def safe_divide(numerator, denominator):
return np.where(denominator == 0, np.nan, numerator / denominator)
In [ ]:
def compute_indices(data):
# Print keys and shapes for debugging (optional, remove if not needed)
print("Keys in data:", data.keys())
for key, arr in data.items():
print(f"Shape of {key}: {arr.shape}")
# Check if all arrays have the same shape
shapes = [arr.shape for arr in data.values()]
if not all(shape == shapes[0] for shape in shapes):
raise ValueError(f"Shape mismatch in bands: {shapes}")
# Compute indices using correct keys
ndvi = safe_divide(data["B08"] - data["B04"], data["B08"] + data["B04"])
ndwi = safe_divide(data["B08"] - data["B11"], data["B08"] + data["B11"])
bsi = safe_divide((data["B11"] + data["B04"]) - (data["B08"] + data["B02"]),
(data["B11"] + data["B04"]) + (data["B08"] + data["B02"]))
ioi = safe_divide(data["B04"] + data["B08"], data["B04"] - data["B08"])
return ndvi, ndwi, bsi, ioi
# Safe division
def safe_divide(numerator, denominator):
return np.where(denominator == 0, np.nan, numerator / denominator)
In [23]:
# Define dates (month-day) based on your previous output
dates = [
"01-10","01-30","02-04","02-24" #March
]
# Initialize dictionaries to store index values over time
index_values = {
"NDVI": [],
"NDWI": [],
"BSI": [],
"IOI": []
}
# Bands to process
bands = ["B02", "B04", "B08", "B11"]
base_path = r"C:\Users\DELL\Downloads\new" # change this to your actual folder path
# Process each date
for date in dates:
band_paths = {band: os.path.join(base_path, f"{date}{band}_(Raw).tiff") for band in bands}
# e.g., "01-03B02_(Raw).tiff"
data = {}
# Load bands
for key, path in band_paths.items():
if os.path.exists(path): # Check if file exists
try:
data[key] = read_band(path)
print(f"Loaded {path} with key {key}, shape: {data[key].shape}")
except Exception as e:
print(f"Error loading {key} for {date}: {e}")
else:
print(f"File not found: {path}")
# Ensure all bands are loaded and have the same shape
if len(data) == 4:
try:
# Compute indices
ndvi, ndwi, bsi, ioi = compute_indices(data)
# Store mean values (ignoring NaN)
index_values["NDVI"].append(np.nanmean(ndvi))
index_values["NDWI"].append(np.nanmean(ndwi))
index_values["BSI"].append(np.nanmean(bsi))
index_values["IOI"].append(np.nanmean(ioi))
except (ValueError, KeyError) as e:
print(f"Error processing {date}: {e}")
else:
print(f"Skipping {date}: Not all bands loaded. Loaded {len(data)} out of 4.")
Loaded C:\Users\DELL\Downloads\new\01-10B02_(Raw).tiff with key B02, shape: (611, 1147) Loaded C:\Users\DELL\Downloads\new\01-10B04_(Raw).tiff with key B04, shape: (611, 1147) Loaded C:\Users\DELL\Downloads\new\01-10B08_(Raw).tiff with key B08, shape: (611, 1147) File not found: C:\Users\DELL\Downloads\new\01-10B11_(Raw).tiff Skipping 01-10: Not all bands loaded. Loaded 3 out of 4. Loaded C:\Users\DELL\Downloads\new\01-30B02_(Raw).tiff with key B02, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\01-30B04_(Raw).tiff with key B04, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\01-30B08_(Raw).tiff with key B08, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\01-30B11_(Raw).tiff with key B11, shape: (593, 1080) Keys in data: dict_keys(['B02', 'B04', 'B08', 'B11']) Shape of B02: (593, 1080) Shape of B04: (593, 1080) Shape of B08: (593, 1080) Shape of B11: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-04B02_(Raw).tiff with key B02, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-04B04_(Raw).tiff with key B04, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-04B08_(Raw).tiff with key B08, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-04B11_(Raw).tiff with key B11, shape: (593, 1080) Keys in data: dict_keys(['B02', 'B04', 'B08', 'B11']) Shape of B02: (593, 1080) Shape of B04: (593, 1080) Shape of B08: (593, 1080) Shape of B11: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-24B02_(Raw).tiff with key B02, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-24B04_(Raw).tiff with key B04, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-24B08_(Raw).tiff with key B08, shape: (593, 1080) Loaded C:\Users\DELL\Downloads\new\02-24B11_(Raw).tiff with key B11, shape: (593, 1080) Keys in data: dict_keys(['B02', 'B04', 'B08', 'B11']) Shape of B02: (593, 1080) Shape of B04: (593, 1080) Shape of B08: (593, 1080) Shape of B11: (593, 1080)
In [24]:
start_date = datetime(2025, 1, 3)
date_nums = [datetime.strptime(d, "%m-%d").replace(year=2025) - start_date for d in dates]
date_nums = [d.days for d in date_nums]
# Create separate plots for each index
fig, axs = plt.subplots(2, 2, figsize=(15, 10), sharex=True)
fig.suptitle("Temporal Changes in Remote Sensing Indices (Jan-Mar)", fontsize=16, y=1.05)
# Indices and their plots
indices = {
"NDVI": {"ax": axs[0, 0], "color": "green", "title": "Normalized Difference Vegetation Index (NDVI)"},
"NDWI": {"ax": axs[0, 1], "color": "blue", "title": "Normalized Difference Water Index (NDWI)"},
"BSI": {"ax": axs[1, 0], "color": "orange", "title": "Bare Soil Index (BSI)"},
"IOI": {"ax": axs[1, 1], "color": "red", "title": "Iron Oxide Index (IOI)"}
}
for index_name, params in indices.items():
ax = params["ax"]
color = params["color"]
title = params["title"]
if index_values[index_name]: # Only plot if there are values
# Plot data
ax.plot(date_nums[:len(index_values[index_name])], index_values[index_name],
marker='o', color=color, linewidth=2, label=index_name)
# Fit a linear trend line
slope, intercept, r_value, p_value, std_err = stats.linregress(date_nums[:len(index_values[index_name])],
index_values[index_name])
trend_line = [slope * x + intercept for x in date_nums[:len(index_values[index_name])]]
ax.plot(date_nums[:len(index_values[index_name])], trend_line, color='k', linestyle='--',
label=f'Trend (R²={r_value**2:.2f})')
# Customize each subplot
ax.set_title(title, fontsize=12)
ax.set_ylabel("Index Value", fontsize=10)
ax.grid(True, linestyle='--', alpha=0.7)
ax.legend()
ax.tick_params(axis='x', rotation=45)
# Add mean and range as text
mean_val = np.nanmean(index_values[index_name])
min_val, max_val = np.nanmin(index_values[index_name]), np.nanmax(index_values[index_name])
ax.text(0.02, 0.98, f'Mean: {mean_val:.3f}\nRange: [{min_val:.3f}, {max_val:.3f}]',
transform=ax.transAxes, fontsize=8, verticalalignment='top', bbox=dict(boxstyle='round', facecolor='white', alpha=0.8))
# Set common x-label
plt.xlabel("Days Since Jan 3", fontsize=12)
# Adjust layout to prevent overlap
plt.tight_layout()
# Show plot
plt.show()
In [25]:
# Optional: Print summary
print("\nSummary of Index Changes:")
for index_name, values in index_values.items():
if values: # Check if there are any values
print(f"{index_name}: Start = {values[0]:.4f}, End = {values[-1]:.4f}, Change = {values[-1] - values[0]:.4f}, Mean = {np.nanmean(values):.4f}")
else:
print(f"{index_name}: No data available")
Summary of Index Changes: NDVI: Start = 0.0380, End = 0.1506, Change = 0.1126, Mean = 0.0856 NDWI: Start = -0.0308, End = 0.0626, Change = 0.0934, Mean = -0.0275 BSI: Start = -0.0570, End = 0.0052, Change = 0.0622, Mean = 0.0089 IOI: Start = -0.1932, End = 1.0623, Change = 1.2555, Mean = 0.1768
In [1]:
import pandas as pd
# Path to your merged file
file_path = "C:\\Users\\DELL\\Downloads\\last year sales2.csv"
# Read the data
df = pd.read_csv(file_path)
# Preview
print(df.head())
print(df.tail())
Sl no. District Name Market Name Commodity Variety Grade Min Price \
0 1 Nashik Nasik Onion Other FAQ 2250
1 2 Nashik Nasik Onion Other FAQ 1400
2 3 Nashik Nasik Onion Other FAQ 900
3 4 Nashik Nasik Onion Pole FAQ 3300
4 5 Nashik Nasik Onion Other FAQ 3300
Max Price Modal Price Price Date
0 3600 3150 14-Aug-24
1 3351 2700 19-Jun-24
2 2701 1950 05-Jun-24
3 4200 3850 26-Sep-24
4 4450 4000 09-Oct-24
Sl no. District Name Market Name Commodity Variety Grade Min Price \
317 318 Nashik Nasik Onion Other FAQ 600
318 319 Nashik Nasik Onion Other FAQ 800
319 320 Nashik Nasik Onion Other FAQ 700
320 321 Nashik Nasik Onion Other FAQ 1000
321 322 Nashik Nasik Onion Pole FAQ 1100
Max Price Modal Price Price Date
317 1700 1400 07-May-24
318 2251 1550 25-May-24
319 3050 2600 17-Jul-24
320 3001 2000 06-Jun-24
321 2700 1975 14-Jan-25
In [ ]:
In [6]:
import pandas as pd
import matplotlib.pyplot as plt
# Path to your merged file
file_path = "C:\\Users\\DELL\\Downloads\\last year sales2.csv"
# Read the data
df = pd.read_csv(file_path)
# Debug: Print actual column names before cleaning
print("Original Columns:")
for col in df.columns:
print(repr(col)) # Shows hidden spaces or special characters
# Clean column names (remove leading/trailing spaces)
df.columns = df.columns.str.strip()
# Debug: Print column names after cleaning
print("\nCleaned Columns:")
print(df.columns.tolist())
# Ensure 'Price Date' is in datetime format
df['Price Date'] = pd.to_datetime(df['Price Date'])
# Group by 'Price Date' and calculate mean for each price type
grouped = df.groupby('Price Date').agg({
'Min Price': 'mean',
'Max Price': 'mean',
'Modal Price': 'mean',
})
# Plot the trends
plt.figure(figsize=(12, 6))
grouped['Max Price'].plot(label='Max Price', marker='o')
grouped['Min Price'].plot(label='Min Price', marker='s')
grouped['Modal Price'].plot(label='Modal Price', marker='^')
plt.title("Onion Prices Trend (Max, Min, Modal)")
plt.xlabel("Date")
plt.ylabel("Price (₹)")
plt.grid(True)
plt.legend()
plt.tight_layout()
plt.show()
Original Columns: 'Sl no.' 'District Name' 'Market Name' 'Commodity' 'Variety' 'Grade' 'Min Price ' 'Max Price ' 'Modal Price ' 'Price Date' Cleaned Columns: ['Sl no.', 'District Name', 'Market Name', 'Commodity', 'Variety', 'Grade', 'Min Price', 'Max Price', 'Modal Price', 'Price Date']
C:\Users\DELL\AppData\Local\Temp\ipykernel_55848\499980830.py:23: UserWarning: Could not infer format, so each element will be parsed individually, falling back to `dateutil`. To ensure parsing is consistent and as-expected, please specify a format. df['Price Date'] = pd.to_datetime(df['Price Date'])
In [26]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Load the CSV
file_path = "C:\\Users\\DELL\\Downloads\\last year sales2.csv"
df = pd.read_csv(file_path)
# Clean column names
df.columns = df.columns.str.strip()
df['Price Date'] = pd.to_datetime(df['Price Date'])
# Group by date and calculate average prices
grouped = df.groupby('Price Date').agg({
'Min Price': 'mean',
'Max Price': 'mean',
'Modal Price': 'mean',
})
# Use all dates
x_labels = grouped.index.strftime('%Y-%m-%d')
x = np.arange(len(x_labels))
width = 0.25
# Create the plot
plt.figure(figsize=(max(14, len(x_labels) * 0.4), 6)) # dynamic width based on date count
plt.bar(x - width, grouped['Min Price'], width=width, label='Min Price', color='skyblue')
plt.bar(x, grouped['Modal Price'], width=width, label='Modal Price', color='mediumseagreen')
plt.bar(x + width, grouped['Max Price'], width=width, label='Max Price', color='salmon')
# Customize plot
plt.xticks(x, x_labels, rotation=90)
plt.xlabel("Date")
plt.ylabel("Price (₹)")
plt.title("Onion Prices per Date (Grouped Bar Chart)")
plt.legend()
plt.grid(axis='y', linestyle='--', alpha=0.7)
plt.tight_layout()
plt.show()
In [27]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Load the CSV
file_path = "C:\\Users\\DELL\\Downloads\\last year sales2.csv"
df = pd.read_csv(file_path)
# Clean column names
df.columns = df.columns.str.strip()
df['Price Date'] = pd.to_datetime(df['Price Date'])
# Group by date and calculate average prices
grouped = df.groupby('Price Date').agg({
'Min Price': 'mean',
'Max Price': 'mean',
'Modal Price': 'mean',
})
# Use all dates
x_labels = grouped.index.strftime('%Y-%m-%d')
x = np.arange(len(x_labels))
width = 0.25
# Taller and wider plot
plt.figure(figsize=(max(14, len(x_labels) * 0.4), 10))
plt.bar(x - width, grouped['Min Price'], width=width, label='Min Price', color='skyblue')
plt.bar(x, grouped['Modal Price'], width=width, label='Modal Price', color='mediumseagreen')
plt.bar(x + width, grouped['Max Price'], width=width, label='Max Price', color='salmon')
# Customize plot
plt.xticks(x, x_labels, rotation=90)
plt.xlabel("Date")
plt.ylabel("Price (₹)")
plt.title("Onion Prices per Date (Grouped Bar Chart)")
plt.legend()
plt.grid(axis='y', linestyle='--', alpha=0.7)
plt.tight_layout()
plt.show()
In [33]:
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
# Load the CSV
file_path = "C:\\Users\\DELL\\Downloads\\last year sales2.csv"
df = pd.read_csv(file_path)
# Clean column names
df.columns = df.columns.str.strip()
df['Price Date'] = pd.to_datetime(df['Price Date'])
# 🔽 Filter for dates greater than or equal to 1-Jan-2025
df = df[df['Price Date'] >= pd.to_datetime('2025-01-01')]
# Group by date and calculate average prices
grouped = df.groupby('Price Date').agg({
'Min Price': 'mean',
'Max Price': 'mean',
'Modal Price': 'mean',
})
# Use all remaining dates
x_labels = grouped.index.strftime('%Y-%m-%d')
x = np.arange(len(x_labels))
# Plot
plt.figure(figsize=(max(14, len(x_labels) * 0.4), 10))
plt.plot(x, grouped['Min Price'], label='Min Price', color='skyblue', marker='o')
plt.plot(x, grouped['Modal Price'], label='Modal Price', color='mediumseagreen', marker='s')
plt.plot(x, grouped['Max Price'], label='Max Price', color='salmon', marker='^')
# Customize plot
plt.xticks(x, x_labels, rotation=90)
plt.xlabel("Date")
plt.ylabel("Price (₹)")
plt.title("Onion Prices per Date (From 1-Jan-2025)")
plt.legend()
plt.grid(axis='y', linestyle='--', alpha=0.7)
plt.tight_layout()
plt.show()
In [38]:
pip install plotly
Requirement already satisfied: plotly in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (6.0.1) Requirement already satisfied: narwhals>=1.15.1 in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from plotly) (1.29.1) Requirement already satisfied: packaging in c:\users\dell\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (from plotly) (24.1) Note: you may need to restart the kernel to use updated packages.
[notice] A new release of pip is available: 24.0 -> 25.0.1 [notice] To update, run: C:\Users\DELL\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip
In [40]:
import pandas as pd
import plotly.graph_objects as go
# Load the CSV
file_path = "C:\\Users\\DELL\\Downloads\\last year sales2.csv"
df = pd.read_csv(file_path)
# Clean column names
df.columns = df.columns.str.strip()
df['Price Date'] = pd.to_datetime(df['Price Date'])
# 🔽 Filter for dates greater than or equal to 1-Jan-2025
df = df[df['Price Date'] >= pd.to_datetime('2025-01-01')]
# Group by date and calculate average prices
grouped = df.groupby('Price Date').agg({
'Min Price': 'mean',
'Max Price': 'mean',
'Modal Price': 'mean',
})
# Create traces for each price type
trace_min_price = go.Scatter(
x=grouped.index,
y=grouped['Min Price'],
mode='lines+markers',
name='Min Price',
line=dict(color='skyblue'),
hoverinfo='x+y+name',
)
trace_modal_price = go.Scatter(
x=grouped.index,
y=grouped['Modal Price'],
mode='lines+markers',
name='Modal Price',
line=dict(color='mediumseagreen'),
hoverinfo='x+y+name',
)
trace_max_price = go.Scatter(
x=grouped.index,
y=grouped['Max Price'],
mode='lines+markers',
name='Max Price',
line=dict(color='salmon'),
hoverinfo='x+y+name',
)
# Create the layout
layout = go.Layout(
title="Onion Prices per Date (From 1-Jan-2025)",
xaxis=dict(title='Date'),
yaxis=dict(title='Price (₹)'),
hovermode='x unified',
template='plotly_dark', # Optional: for a dark theme
)
# Create the figure
fig = go.Figure(data=[trace_min_price, trace_modal_price, trace_max_price], layout=layout)
# Show the plot
fig.show()
In [ ]:
In [ ]:
In [ ]: